package com.foreknow.elmboot.controller;

import com.foreknow.elmboot.po.Orders;
import com.foreknow.elmboot.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/OrdersController")
public class OrdersController {

    @Autowired
    private OrderService orderService;

    @RequestMapping("/saveOrders")
    public int saveOrders(Orders orders){
        return orderService.saveOrders(orders);
    }

    @RequestMapping("/getOrdersById")
    public Orders getOrdersById(Integer orderId){
        return orderService.getOrdersById(orderId);
    }

    @RequestMapping("/listOrderByUserId")
    public List<Orders> listOrderByUserId(String userId){
        return orderService.listOrderByUserId(userId);
    }

}
